package com.lzg;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author lizhigang Date: 2019/9/12 14:32
 * @description:
 */
public class Bill {
	private List<Item> items = new ArrayList<>();

	public void addItems(Item item){
		items.add(item);
	}

	public void removeItems(Item item){
		items.remove(item);
	}

	public int getSumCents(){
		return items.stream().mapToInt(Item -> Item.getCents()).sum();
	}

	public void pay(Payment repayment){
		repayment.pay(getSumCents());
	}
}
